# 05-随堂练习.py
'''
taobao itcast python
taobao python itcast
beijing shanghai taobao
shenzhen guangzhou taobao
wuhan hangzhou taobao
zhengzhou bigdata taobao
把以上内容存储在一个文本文件中
'''
# 1、读取文件
def count_taobao(path,target):
    count = 0
    # 打开文件
    with open(path,"r",encoding="utf-8") as file:
        # 读取文件内容
        content = file.read()
        # 统计数量
        count = content.count(target)
    return count    
# 2、统计出taobao出现的次数
print(count_taobao('./06-taobao.txt','taobao'))